var isPalindrome = function (x) {
  if (x < 0) return false
  // 将数字转换为字符串
  x = x + ''
  let left = 0
  let right = x.length - 1
  while (left < right) {
    if (x[left] != x[right]) return false
    left++
    right--
  }
  return true
}
console.log(isPalindrome(1212));